home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / patch / WHDIGamesU-Z.lzh / Uridium2.lha / WHD_UridiumII / Install < prev    next >
Text File  |  2001-08-22  |  10KB  |  417 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME   "Uridium II")
  5. (set #CFG_APPSLV    "U2HD")
  6. (set #CFG_APPGUI    "Uridium II")
  7. (set #CFG_APPGUIINF "Game")
  8. (set #CFG_APPVER    "R0801.1")
  9. (set #CFG_APPCOPY   "1997-2001")
  10.  
  11. ;================================================================================
  12.  
  13. ;------------------------------------------------------------------------------------
  14. ; checks if given program is reachable via the path, if not abort install
  15.  
  16. (procedure P_CheckRun (
  17.     (if (<> 0 (run (cat "Which <>NIL: " #VP1)))(
  18.         (abort
  19.             (cat
  20.                 "Could not find the program\n\n"
  21.                 "'" #VP1 "'\n\n"
  22.                 "which is required to perform the installation!\n\n"
  23.                 "Please install the '" #VP1 "' program ensuring that"
  24.                 " it is accessible on the path, then try the installation again."
  25.             )
  26.         )
  27.     ))
  28. ))
  29.  
  30. ;------------------------------------------------------------------------------------
  31. ; create installation directories if required
  32.  
  33. (procedure P_InstallDirs (
  34.     ;
  35.     ; Create data dir if required
  36.     ;
  37.     (if (<> 2 (exists #VDATDIR))(
  38.         (makedir #VDATDIR
  39.             (prompt "The directory '" #VDATDIR "' will now be created")
  40.             (help @makedir-help)
  41.             (confirm)
  42.         )
  43.     ))
  44. ))
  45.  
  46.  
  47. ;------------------------------------------------------------------------------------
  48. ; make game data
  49.  
  50. (procedure P_InstallGame (
  51.     ;
  52.     ; if we have disk images in the VDESTDIR, assume the user
  53.     ; is upgrading a v.1x installation and move them to VDATDIR
  54.     ;
  55.     (set #VT1 (tackon #VDESTDIR "Disk.1"))
  56.     (if (= 1 (exists #VT1))(
  57.         (working "Moving existing disk images")
  58.         (copyfiles
  59.             (prompt "Moving existing disk image")
  60.             (help @copyfiles-help)
  61.             (source #VT1)
  62.             (dest #VDATDIR)
  63.             (optional fail force)
  64.         )
  65.     ))
  66.  
  67.     (set #VT1 (tackon #VDESTDIR "Disk.2"))
  68.     (if (= 1 (exists #VT1))(
  69.         (working "Moving existing disk images")
  70.         (copyfiles
  71.             (prompt "Moving existing disk image")
  72.             (help @copyfiles-help)
  73.             (source #VT1)
  74.             (dest #VDATDIR)
  75.             (optional fail force)
  76.         )
  77.     ))
  78.  
  79.     ;
  80.     ; Set path to game data file
  81.     ;
  82.     (set #VDATFILE (tackon #VDATDIR "Disk.1"))
  83.  
  84.     ;
  85.     ; install data files if not found
  86.     ;
  87.     (if (<> 1 (exists #VDATFILE))(
  88.         ;
  89.         ; tell user what is happening
  90.         ;
  91.         (message
  92.             (cat
  93.                 "\n\n\nThe installer will now create the game data files\n"
  94.                 "Follow the prompts to insert the game disks when required\n\n"
  95.                 "Click 'Proceed' when ready."
  96.             )
  97.         )
  98.  
  99.         ;
  100.         ; call the imager slave
  101.         ;
  102.         (working "Creating data files in '" #VDATDIR "'")
  103.  
  104.         (copyfiles
  105.             (prompt "Copying data file creation slave")
  106.             (help @copyfiles-help)
  107.             (source "ISlave")
  108.             (dest #VDATDIR)
  109.             (nogauge)
  110.             (optional fail force)
  111.         )
  112.  
  113.         (set @execute-dir #VDATDIR)
  114.         (run (cat "RawDIC SLAVE=ISlave"))
  115.         (set @execute-dir #VOLDEXEDIR)
  116.  
  117.         (delete (tackon #VDATDIR "ISlave") (optional force))
  118.     ))
  119.  
  120.     ;
  121.     ; check the main data file was created
  122.     ;
  123.     (if (<> 1 (exists #VDATFILE))(
  124.         (abort (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  125.                     "The installer could not extract the game data files.\n\n"
  126.                     "Please contact the author for further information\n"
  127.         ))
  128.     ))
  129.  
  130.     ;
  131.     ; upgrade v1.x high scores
  132.     ;
  133.     (set #VT1 (tackon #VDESTDIR "u2info.bin"))
  134.     (if (= 1 (exists #VT1))(
  135.         (working "Upgrading v1.x High Score Table")
  136.         (set #VT2
  137.             (run (cat "U2HSConv12 " #VT1 " " (tackon #VDATDIR "Disk.2")))
  138.         )
  139.  
  140.         (if (= 0 #VT2)(
  141.             (delete #VT1 (optional nofail force))
  142.         ))
  143.     ))
  144. ))
  145.  
  146. ;------------------------------------------------------------------------------------
  147. ; install WHDLoad slave program
  148.  
  149. (procedure P_InstallSlave (
  150.  
  151.     (working "Installing slave program")
  152.  
  153.     ; first, clean up previous installations
  154.     (set #VT1 (tackon #VDESTDIR "Disk.1"))
  155.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  156.  
  157.     (set #VT1 (tackon #VDESTDIR "Disk.2"))
  158.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  159.  
  160.     (set #VT1 (tackon #VDESTDIR "u2config.bin"))
  161.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  162.  
  163.     (set #VT1 (tackon #VDESTDIR "WHDLoad"))
  164.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  165.  
  166.     (set #VT1 (tackon #VDESTDIR "Uridium-II_HD"))
  167.     (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  168.  
  169.     (set #VT1 (tackon #VDESTDIR "Uridium-II_HD.info"))
  170.     (set #VT2 (tackon #VDESTDIR "Uridium II.info"))
  171.     (if (= 1 (exists #VT2))
  172.         (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  173.         (if (= 1 (exists #VT1)) (rename #VT1 #VT2) )
  174.     )
  175.  
  176.     ; get chip memory size version information
  177.     (if (< #VVERINFA 0)(
  178.         (if (database "chiprev" "AA")
  179.             (set #VVERINFA 2)
  180.             (set #VVERINFA 1)
  181.         )
  182.     ))
  183.  
  184.     ; copy slave program
  185.     (set #VT1 "Slave")
  186.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  187.  
  188.     (copyfiles
  189.         (prompt "Copying slave program")
  190.         (help @copyfiles-help)
  191.         (source #VT1)
  192.         (newname #CFG_APPSLV)
  193.         (dest #VDESTDIR)
  194.         (nogauge)
  195.         (optional fail force)
  196.     )
  197.  
  198. ))
  199.  
  200. ;------------------------------------------------------------------------------------
  201. ; install GUI
  202.  
  203. (procedure P_InstallGUI (
  204.     ; copy GUI program if it exists
  205.     (if (= 1 (exists "GUI"))(
  206.         (copyfiles
  207.             (prompt "Copying GUI program")
  208.             (help @copyfiles-help)
  209.             (source "GUI")
  210.             (newname #CFG_APPGUI)
  211.             (dest #VDESTDIR)
  212.             (nogauge)
  213.             (optional fail force)
  214.         )
  215.     ))
  216.  
  217.     ; see if the user wants or needs to install an icon
  218.  
  219.     (set #VT1 (cat #CFG_APPGUI ".info"))
  220.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  221.         ; no icon exists, quietly copy one in
  222.         (set #VT2 1)
  223.     )(
  224.         ; icon exists, ask user if they want to overwrite it
  225.         (set #VT2
  226.             (askbool
  227.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" icon ?"))
  228.                 (default 1)
  229.                 (help @askchoice-help)
  230.             )
  231.         )
  232.     ))
  233.  
  234.     ; install the icon if required
  235.  
  236.     (if (= 1 #VT2)(
  237.         ; get choice of icon format
  238.         (set #VT3
  239.             (askchoice
  240.                 (prompt "Which type of icon would you like to install for " #CFG_APPGUI " ?")
  241.                 (choices "Standard" "NewIcon" "OS3.5+ Coloricon")
  242.                 (help @askchoice-help)
  243.             )
  244.         )
  245.         (if (= 0 #VT3)
  246.             (set #VT3 ".oi")
  247.             (if (= 1 #VT3)
  248.                 (set #VT3 ".ni")
  249.                 (if (= 2 #VT3)
  250.                     (set #VT3 ".ci")
  251.                 )
  252.             )
  253.         )
  254.  
  255.         ; install the icon
  256.         (copyfiles
  257.             (prompt "Copying icon")
  258.             (help @copyfiles-help)
  259.             (source (cat #CFG_APPGUIINF #VT3))
  260.             (newname #VT1)
  261.             (dest #VDESTDIR)
  262.             (noposition)
  263.             (nogauge)
  264.             (optional fail force)
  265.         )
  266.     ))
  267.  
  268.     ; set required icon tooltypes
  269.  
  270.     (working "Setting icon tooltypes")
  271.     (set #VT1 (tackon #VDESTDIR #CFG_APPGUI))
  272.  
  273.     (if (<> 1 (exists "GUI"))(
  274.         ; no GUI, set WHDLoad tooltypes
  275.         (tooltype (dest #VT1) (setstack 16384))
  276.  
  277.         (set #VT2 "0d180cd9")
  278.         (iconinfo (dest #VT1) (gettooltype "PRELOAD" "#VT2"))
  279.         (if (= "0d180cd9" #VT2)(
  280.             (tooltype (dest #VT1) (settooltype "PRELOAD" ""))
  281.         ))
  282.  
  283.         (set #VT2 "0d180cd9")
  284.         (iconinfo (dest #VT1) (gettooltype "SLAVE" "#VT2"))
  285.         (if (<> #CFG_APPSLV #VT2)(
  286.             (tooltype (dest #VT1) (settooltype "SLAVE" #CFG_APPSLV))
  287.         ))
  288.  
  289.         (set #VT2 "0d180cd9")
  290.         (iconinfo (dest #VT1) (gettooltype "BUTTONWAIT" "#VT2"))
  291.         (if (= "0d180cd9" #VT2)(
  292.             (tooltype (dest #VT1) (settooltype "BUTTONWAIT" ""))
  293.         ))
  294.  
  295.         (set #VT2 "0d180cd9")
  296.         (iconinfo (dest #VT1) (getdefaulttool "#VT2"))
  297.         (if (= "0d180cd9" #VT2)(
  298.             (tooltype (dest #VT1) (setdefaulttool "WHDLoad"))
  299.         ))
  300.     )(
  301.         ; GUI, set default tooltypes
  302.         (tooltype (dest #VT1) (setstack 16384))
  303.     ))
  304. ))
  305.  
  306. ;------------------------------------------------------------------------------------
  307. ; install instructions
  308.  
  309. (procedure P_InstallReadme (
  310.     ; does the user want to install the readme?
  311.     (set #VT1
  312.         (askbool
  313.             (prompt (cat "Do you want to install the \"" #CFG_APPGUI "\" readme ?"))
  314.             (default 1)
  315.             (help @askchoice-help)
  316.         )
  317.     )
  318.  
  319.     ; copy the readme if required
  320.     (if (= 1 #VT1)(
  321.         (copyfiles
  322.             (prompt "Copying readme")
  323.             (help @copyfiles-help)
  324.             (source "Instructions")
  325.             (newname (cat #CFG_APPNAME ".readme"))
  326.             (dest #VDESTDIR)
  327.             (infos)
  328.             (noposition)
  329.             (nogauge)
  330.             (optional nofail force)
  331.         )
  332.     ))
  333. ))
  334.  
  335. ;------------------------------------------------------------------------------------
  336. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  337.  
  338. ;
  339. ; initialise
  340. ;
  341. (set @app-name #CFG_APPNAME)
  342. (set #VOLDEXEDIR @execute-dir)
  343. (set #VVERINFA -1)
  344. (set #VVERINFB -1)
  345. (set #VVERINFC -1)
  346. (set #VDESTDIR @default-dest)
  347.  
  348. ;
  349. ; check settings
  350. ;
  351. (if    (< @user-level 1)              (abort "You must select 'Expert' or 'Intermediate' user level"))
  352. (if    (< @installer-version 2818051) (abort "This product requires at least version 43.3 of the Installer program"))
  353.  
  354. ;
  355. ; check required programs are available
  356. ;
  357. (set #VP1 "RawDIC")
  358. (P_CheckRun)
  359. (set #VP1 "WHDLoad")
  360. (P_CheckRun)
  361.  
  362. ;
  363. ; welcome message
  364. ;
  365. (message "\n\n\nWelcome to the " #CFG_APPNAME " HD Installer " #CFG_APPVER "\n\n"
  366.          "© " #CFG_APPCOPY " Halibut Software\n\n"
  367.          "Please read the documentation thoroughly "
  368.          "before attempting to use this installer!\n\n"
  369.          "Click 'Proceed' to begin..."
  370. )
  371.  
  372. ;
  373. ; get directory to install in
  374. ;
  375. (set #VDESTDIR
  376.     (askdir
  377.         (prompt "Where would you like the game installed?\n"
  378.                 "If you have an existing installation select that directory,\n"
  379.                 "otherwise create / select the directory to install the game into."
  380.         )
  381.         (help @askdir-help)
  382.         (default @default-dest)
  383.         (disk)
  384.         (newpath)
  385.     )
  386. )
  387. (set #VDESTDIR (expandpath #VDESTDIR))
  388. (set @default-dest #VDESTDIR)
  389. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  390.  
  391. ;
  392. ; create the installation directories
  393. ;
  394. (P_InstallDirs)
  395.  
  396. ;
  397. ; install the game data
  398. ;
  399. (P_InstallGame)
  400.  
  401. ;
  402. ; install the slave
  403. ;
  404. (P_InstallSlave)
  405.  
  406. ;
  407. ; install the GUI and/or icons
  408. ;
  409. (P_InstallGUI)
  410.  
  411. ;
  412. ; install the readme
  413. ;
  414. (P_InstallReadme)
  415.  
  416. ;=======================================================================
  417. ;$VER: Uridium II Installer script R0801.1 © 1997-2001 Halibut Software